<template>
	<view>
		<navbar :backshow="true" :title="title" :navBarHeight="navBarHeight" :menuRight="menuRight" :menuTop="menuTop"
			:menuHeight="menuHeight"></navbar>
		<!-- 头部展位 -->

		<view class="main" :style="{ height: mainheight + 'px' }"></view>
		<view class="ysboxmain">
			<uni-section title="验收评价" type="line">
				<view class="ysitembox">
					<view class="ysitem" v-for="item in formData.evaluateContent">
						{{item.cause}} {{item.score}}分
					</view>
				</view>
			</uni-section>
			<uni-section title="详情图片" type="line">
				<view class="ysimgbox">
					<view class="ysimgitem" v-for="item  in parseJSONs(formData.evaluatePhoto)">
						<image :src="item" mode=""></image>
					</view>
				</view>
			</uni-section>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "验收结果",
				navBarHeight: 50, // 导航栏高度
				menuRight: 10, // 胶囊距右方间距（方保持左、右间距一致）
				menuTop: 50, // 胶囊距底部间距（保持底部间距一致）
				menuHeight: 0, // 胶囊高度（自定义内容可与胶囊高度保证一致）
				mainheight: 60,
				activeTab: 0,
				formData: {},
				id: ''
			}
		},
		onLoad() {
			const that = this;

			// 获取系统信息
			const systemInfo = wx.getSystemInfoSync();
			// 胶囊按钮位置信息
			const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
			// 导航栏高度 = 状态栏高度 + 44
			that.navBarHeight = systemInfo.statusBarHeight + 44;
			that.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
			that.menuTop = menuButtonInfo.top;
			that.menuHeight = menuButtonInfo.height;
			that.mainheight = menuButtonInfo.top + menuButtonInfo.height;
			// 获取一下 最新数据

			uni.getStorage({
				key: "yxroom",
				success: (res) => {
					console.log("获取的数据：", res.data);
					// 可以在这里处理获取到的数据
					this.id = res.data.appointmentId;
					this.$myRequest({
						url: '/client/appointment/getRoomAppointmentInfo',
						method: "GET",
						data: {
							appointmentId: this.id
						}
					}).then((res) => {
						if (res.code == 200) {
							this.formData = res.data
							console.log("查询设备详情：", res.data);
						}
					})

				},
				fail: function() {
					console.error("获取数据失败");
				},
			});

		},
		methods: {
			parseJSONs(str) {
				try {
					return JSON.parse(str);
				} catch (error) {
					// JSON.parse 出错时捕获异常
					// console.error('解析 JSON 出错:', error);
					return str;
				}
			},
		}
	}
</script>

<style>

</style>